<template>
  <div class="lisa-tabbar bor-top-shadow">
    <div class="lisa-tabbar-item"
       v-for="(item,index) in tabbarList" :key="index"
       @click="toPush(item.link)"
       :class="[{'bor-right':(index+1) !== tabbarList.length}]">
      <i class="iconfont f12 c-01a4f6" :class="item.icon"></i>
      <span class="f14">{{item.title}}</span>
    </div>
  </div>
  <!--<tabbar>-->
    <!--<tabbar-item :link="item.link"  v-for="(item,index) in tabbarList" :key="index" >-->
    <!--&lt;!&ndash;<img slot="icon" :src="item.imgurl">&ndash;&gt;-->
    <!--<i class="iconfont f12 c-01a4f6" :class="item.icon"></i>-->
    <!--<span slot="label">{{item.title}}</span>-->
    <!--</tabbar-item>-->
  <!--</tabbar>-->
</template>

<script type="text/ecmascript-6">
  import * as ThreeStorage from '@/utils/store/token.js'
  import { Tabbar, TabbarItem } from 'vux'
  export default {
    name: 'tabbar',
    data() {
      return {
        tabbarType: '', // company or dirver
        tabbarList: [],
        headClass: 'active'
      }
    },
    created() {
      this.initTabber()
    },
    mounted() {
    },
    components: {
      Tabbar, TabbarItem
    },
    methods: {
      initTabber: function() {
        const tabbarType = ThreeStorage.getLoginType()
        let toMeLink = ''
        let toHomeLink = ''
        let toShipOrderLink = ''
        // console.log('login-type', tabbarType)
        if (tabbarType === 'company') {
          toMeLink = 'me-adminLanding'
          toHomeLink = 'admin-home'
          toShipOrderLink = 'shipOrder-list'
        } else {
          toMeLink = 'me-driverLanding'
          toHomeLink = 'driver-home'
          toShipOrderLink = 'shipOrder-list'
        }
        this.tabbarList = [
          { title: '首页', link: toHomeLink, icon: 'icon-home' },
          { title: '运单', link: toShipOrderLink, icon: 'icon-shipOrder' },
          { title: '我的', link: toMeLink, icon: 'icon-me' }
        ]
      },
      toPush: function(name) {
        this.$router.push({ name: name })
      }
    }
  }
</script>

<style scoped>
  .f12{
    font-size: .20rem;
  }
  .lisa-tabbar{
    background-color: #fff;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
  }
  .lisa-tabbar-item{
    width: 33%;
    padding-bottom: .04rem;
  }
  .lisa-tabbar-item>span, .lisa-tabbar-item>i{
    display: block;
  }
</style>
